All Questions
Tagged with javascriptobject-oriented
394 questions
3votes
1answer
91views
Merge discrete integer intervals
What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
1vote
3answers
2kviews
Math calculation JavaScript. Am I using Objects correctly? Can I use methods / functions to shorten my code further? Also error logging?
Context- CRM system, front-end form. Requirement- Within a form users have to give a rating to a section based on user inputs, each rating has different weighting. The rating is stored in an option ...
2votes
2answers
198views
First app with JS in OOP
I've already started to creating apps in JS with OOP. I made simple TicTacToe Game in OOP and I want to ask you to review my code and point out everything that I can change about OOP. What is bad ...
1vote
1answer
143views
Rock, paper, scissors game in expressjs typescript
This is a simple 2 player game made in NodeJS and the ExpressJS framework with typescript. I've built using OOP approach to as far of an extent as I know of it. I'm really curious as to how further ...
1vote
1answer
140views
Transform an array into object and set index for an unique key in javascript
I have a method that merges keys and indexes from an array into an object. I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler. Goal get an array of objects ...
1vote
1answer
201views
Terminal War Game
First I would like to thank everyone for whatever help you may offer me. In full disclosure this is a project for a bootcamp class I have. My problem is, and I've asked them about this, that they aren'...
3votes
1answer
77views
I made a webpage that simulates sharks eating fish in the torrid world of Wa-tor
I've been self-studying HTML/CSS/JS. I read about Wa-tor. It's a population dynamics simulation which simulates fish and sharks breeding and predating. This seemed cool so I decided to implement it....
4votes
1answer
187views
GUI tower defense: path and enemies
Working on creating new tower defense in JS. May be port to React. How to improve? Only made enemies and path so far. In below demo, path is white background and enemy is red circles and green squares....
2votes
1answer
173views
Creating object in JS that is passed into IHttpHandler
I am working on a web page where I am creating a JS object using {} and []. This object is passed into a handler I wanted to ...
2votes
2answers
319views
Tic-Tac-Toe vanilla JS Pseudo OOP
I'm working on building a simple game in vanilla JS (tic-tac-toe). Some weeks ago I created a functional MVP and asked some questions about it (Vanilla JS Tic-Tac-Toe). The code worked, but it was a ...
0votes
1answer
43views
Is there any way to make my JavaScript code more logical and efficient? How to convert functional to OOP in JS? [closed]
I created some tooltips using javascript but after writing the code I found it a lot more complicated and hard to read/understand is there any way to shortened my ...
1vote
1answer
418views
Best way to cherry pick objects from array of objects
With this data I am returning one object per keyword prioritising preferedDomain string on domain and then its higher ...
2votes
2answers
125views
Complex Filter in one Opration
I am working on a Data-based application. I wrote a code to filter the table. The table has String and Numbers. I some filter ...
1vote
1answer
287views
Managing duplicate class instances in a javascript Set
I have a class called Thing. For simplicity, let's say it initializes with a unique id, and that's all that's unique about it: ...
2votes
1answer
341views
JavaScript copy-to-clipboard class
I am have made a small copy-to-clipboard script. I have made a method called copyToClipboard that does the following: create an input box; read the content of an ...